package com.halfsword.creativecraft.datagen;

import com.halfsword.creativecraft.CreativeCraft;
import com.halfsword.creativecraft.block.BlockLoader;
import com.halfsword.creativecraft.utils.SpaceTags;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.tags.BlockTags;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.BlockTagsProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.CompletableFuture;

public class BlockTagGenerator extends BlockTagsProvider {
    public BlockTagGenerator(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, @Nullable ExistingFileHelper existingFileHelper) {
        super(output, lookupProvider, CreativeCraft.MOD_ID, existingFileHelper);
    }

    @Override
    protected void addTags(HolderLookup.Provider provider) {
        //noinspection unchecked
        this.tag(SpaceTags.Blocks.SPACEDECECTOR_VALUABLES).addTags(Tags.Blocks.ORES)
                .add(BlockLoader.BLOCK_SPACE.get(),
                        BlockLoader.BLOCK_RAW_SPACE.get(),
                        BlockLoader.BLOCK_TITANIUM.get(),
                        BlockLoader.ORE_SPACE.get(),
                        BlockLoader.DEEPSLATE_ORE_SPACE.get(),
                        BlockLoader.END_ORE_SPACE.get(),
                        BlockLoader.NETHER_ORE_SPACE.get(),
                        BlockLoader.BLOCK_SPACE_RESONANCE.get());

        this.tag(BlockTags.MINEABLE_WITH_PICKAXE)
                .add(BlockLoader.BLOCK_SPACE.get(),
                        BlockLoader.BLOCK_RAW_SPACE.get(),
                        BlockLoader.ORE_SPACE.get(),
                        BlockLoader.DEEPSLATE_ORE_SPACE.get(),
                        BlockLoader.END_ORE_SPACE.get(),
                        BlockLoader.NETHER_ORE_SPACE.get(),
                        BlockLoader.BLOCK_SPACE_RESONANCE.get());

        this.tag(BlockTags.NEEDS_DIAMOND_TOOL).add(BlockLoader.BLOCK_SPACE.get());
        this.tag(BlockTags.NEEDS_IRON_TOOL).add(BlockLoader.BLOCK_SPACE.get());
        this.tag(BlockTags.NEEDS_STONE_TOOL).add(BlockLoader.BLOCK_SPACE.get());
        this.tag(Tags.Blocks.NEEDS_NETHERITE_TOOL).add(BlockLoader.BLOCK_SPACE.get());
        this.tag(SpaceTags.Blocks.NEEDS_SPACE_TOOL).add(BlockLoader.BLOCK_SPACE_RESONANCE.get());

        this.tag(BlockTags.FENCES).add(BlockLoader.FENCE_SPACE.get());
        this.tag(BlockTags.FENCE_GATES).add(BlockLoader.FENCE_GATE_SPACE.get());
        this.tag(BlockTags.WALLS).add(BlockLoader.WALL_SPACE.get());

    }
}
